<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('评论操作')" />
    <th:block th:include="include :: select2-css" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <p>评论ID：</p>
                                <input name="commentId" th:value="${commentId}" class="form-control" />
                            </li>
                            <li>
                                <p>类型ID：</p>
                                <input name="typeId" class="form-control" />
                            </li>
                            <li>
                                <p>操作状态：</p>
                                <select name="visible" class="form-control" th:with="type=${@dictTag.getType('cms_comment_hand_visible')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                                        th:value="${dict.dictValue}">
                                </select>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="cms:comment:hand">
                    <i class="fa fa-remove"></i> 删除
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: select2-js" />
    <script th:inline="javascript">
        var removeFlag = [[${@permission.hasPermi('cms:comment:hand')}]];
        var hv = [[${@dictTag.getType('cms_comment_hand_visible')}]];
        var prefix = ctx + "cms/comment";
        $(function() {
            var options = {
                url: prefix + "/handList",
                removeUrl: prefix + "/deleteCmsCommentHandByIds",
                modalName: "评论操作",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'handId',
                    title: '控制ID'
                },
                {
                    field: 'commentId',
                    title: '评论ID'
                },
                {
                    field: 'typeId',
                    title: '类型ID',
                    align: 'left'
                },
                {
                    field: 'userId',
                    title: '用户Id'
                },
                {
                    field: 'visible',
                    title: '状态',
                    formatter: function (value, row, index) {
                        console.log(value+"dffff");
                        return $.table.selectDictLabel(hv, value);
                    }
                },
                {
                    field: 'ip',
                    title: 'ip'
                },
                {
                    field: 'userSystem',
                    title: '系统'
                },
                {
                    field: 'userBower',
                    title: '浏览器'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.handId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>